package com.poorstu.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.common.base.web.BaseAction;
import com.poorstu.manager.PartTimeManager;
import com.poorstu.manager.StudentManager;
import com.poorstu.model.PartTimeMod;
import com.poorstu.model.UserPartTimeMod;

public class StuFindPtDetilAction extends BaseAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try{
			DynaActionForm dyna=(DynaActionForm)form;
			int jobId=(Integer)dyna.get("jobId");
			
			PartTimeManager partTime=(PartTimeManager)getBean("partTimeManager");
			//StudentManager studentManager=(StudentManager)getBean("studentManager");
			UserPartTimeMod uptm=partTime.selectUserPartTimeId(jobId);
			request.setAttribute("applyNumber", uptm.getApplyNumber());
			request.setAttribute("applyPassNumber", uptm.getApplyPassNumber());
			
			//studentManager.selectUserPartTime();
			
			PartTimeMod part=partTime.selectPartTimeById(jobId);
			request.setAttribute("jobId", part.getJobId());
			request.setAttribute("company", part.getCompany());
			request.setAttribute("conPhone", part.getConPhone());
			request.setAttribute("contactName", part.getContactName());
			request.setAttribute("content", part.getContent());
			request.setAttribute("emile", part.getEmile());
			request.setAttribute("startTime", part.getStartTime());
			request.setAttribute("endTime", part.getEndTime());
			request.setAttribute("status", part.getStatus());
			request.setAttribute("salary", part.getMoney());
			request.setAttribute("peopleNum", part.getPeopleNum());
			request.setAttribute("other", part.getOther());
			
			return mapping.findForward("succ");
			}catch(Exception e)
			{
				e.printStackTrace();
				return mapping.findForward("failure");
			}
		}
	}
